import 'package:flutter/material.dart';
import 'package:flutter_massage/common_lib/index.dart';
import 'package:flutter_massage/pages/web/web_view.dart';
import 'package:flutter_massage/service/index.dart';

class SameCityPage extends StatefulWidget {
  const SameCityPage({super.key});

  @override
  State<SameCityPage> createState() => _SameCityPageState();
}

class _SameCityPageState extends State<SameCityPage> with AutomaticKeepAliveClientMixin {
  String url = '';

  @override
  void initState() {
    super.initState();
    init();
  }

  void init() async {
    SettingBean bean = await XydUserService.getCacheMineInfoBean(refresh: true);

    setState(() {
      url = bean.findUrl ?? '';
    });
  }

  // void init() async {
  //   double lng = await LocationService.instance.longitude;
  //   double lat = await LocationService.instance.latitude;
  //   String version = await ConstantValues.version;
  //   String appName = await ConstantValues.appName;
  //   String tdid = await ConstantValues.tdid;
  //   String device = await ConstantValues.device;
  //
  //   String param =
  //       'versjon=$version&thjenc=${ConstantValues.client}&devjte=$device&jdfw=${ConstantValues.idfa}&devjte_copen=${ConstantValues().deviceToken}&cdjd=$tdid&hng=$lng&hwc=$lat&appname=$appName&key=${XydUserService.key}&kefu=${XydUserService.kefu}';
  //   setState(() {
  //     url = 'https://lamapi.chwxkj.top/find/?$param';
  //   });
  // }

  @override
  Widget build(BuildContext context) {
    super.build(context);

    return url.notEmpty ? WebH5Page(url: url, title: '同城', showBack: false) : Container();
  }

  @override
  bool get wantKeepAlive => true;
}
